﻿using System.Collections.Generic;
using com.guojin.core.io;
using com.guojin.core.io.message;


namespace com.guojin.mj.net.message.game
{
    public class TakeInScoreReq: Message
    {
        public static int TYPE = 12 ;
        public static int ID =  33 ;

        public int Score { get; set; }
        public int LocationIndex { get; set; } //玩家编号
        public string Approver { get; set; }   

        public void decode(Input _in)
        {
            Score = _in.readInt();
            LocationIndex = _in.readInt();
            Approver = _in.readString();
        }

        public void encode(Output _out)
        {
            _out.writeInt(Score);
            _out.writeInt(LocationIndex);
            _out.writeString(Approver);
        }

        public int getMessageId()
        {
            return ID;
        }

        public int getMessageType()
        {
            return TYPE;
        }

        public string toString()
        {
            return string.Format("Score= {0}, locationIndex={1}, approver={2}", Score,LocationIndex, Approver);
        }

        public static TakeInScoreReq create(int score, int locationIndex, string approver)
        {
            var temp = new TakeInScoreReq();
            temp.Score = score;
            temp.LocationIndex = locationIndex;
            temp.Approver = approver;
            return temp;
        }
    }
}